home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Run Magazine ReRun 1989 July & August
/
rerun-1989-07-08.d64
/
a-z scramble
(
.txt
)
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
72 lines
1 rem the game of scramble
2 rem by brian melcher
5 poke53280,0:poke53281,0:print"[147] [156][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
10 print" [192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
15 print"[158] [221] "
20 print" [192][192] [221] [221] [221] [192][192]"
25 print" [192][192] [192] [167] [165] [192] "
30 print" [192][192] [221] [221] [167] [165] [221] [192][192]"
35 print" [146][181] [221] [167] [180] "
40 printspc(10)"the game of scramble"
45 print" [192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
50 print" [156][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192][192]"
55 diml$(64),s(5):printspc(9)"[159]press space when ready"
60 geta$:ifa$<>" "then60
65 print"[147][156] [192][192][192][192][192][192][192][192]":print"[159] scramble":print"[156] [192][192][192][192][192][192][192][192][158]"
70 print" how many players (1-5)"
75 geta$:ifa$<"1"ora$>"5"then75
80 p=val(a$):print" how many chances (1-5)"
85 geta$:ifa$<"1"ora$>"5"then85
90 c=val(a$):print" enter grid size (2-8)"
95 geta$:ifa$<"2"ora$>"8"then95
100 g=val(a$):form=1to5:s(m)=999999:next:b=1:ifg>4thenb=2:ifg=8thenb=3
105 forh=1toc:fori=1top:j=0
110 form=1tog*g:l$(m)=chr$(int(rnd(0)*26)+65):next:z=0:gosub340:ifz=1then110
115 print"[147]"spc(14);:form=1tog:print"[158] "chr$(64+m);:next:print" "
120 form=1tog:printspc(14)"[158] [146][151]";:forn=1tog:print" [170]";:next:print
125 printspc(14)"[158]"chr$(48+m);:forn=1tog:print"[146][151] [170]";:next:print
130 printspc(14)"[158] [146][151]";:forn=1tog:print"[175][175][186]";:next:ifm<gthenprint
135 next:print"[159] player"i"up":print" trial"h:print" [156]best times:"
140 form=1top:print" player"m"[157]:":print" "s(m):next:print""
145 gosub325:print" [158]enter move"
150 print" ";:e=1:u$="":v$="":w$="":x$=""
155 geta$:ifa$=""then155
160 ifa$=chr$(20)then150
165 ifa$="\"thenj=999999:goto275
170 ife=2then215
175 ifa$<"a"ora$>chr$(64+g)then190
180 ifu$<>""then155
185 u$=a$:goto205
190 ifa$<"1"ora$>chr$(48+g)then155
195 ifw$<>""then155
200 w$=a$
205 ifu$<>""andw$<>""thene=2
210 goto250
215 ifa$<"a"ora$>chr$(64+g)then230
220 ifv$<>""then155
225 v$=a$:goto245
230 ifa$<"1"ora$>chr$(48+g)then155
235 ifx$<>""then155
240 x$=a$
245 ifv$<>""andx$<>""thene=3
250 printa$;:ife<3then155
255 ifu$=v$andw$=x$then150
260 u=asc(u$):v=asc(v$):w=asc(w$):x=asc(x$):ifabs(u-v)>borabs(w-x)>bthen150
265 q=(u-64)+(w-49)*g:r=(v-64)+(x-49)*g:j=j+1:t$=l$(q):l$(q)=l$(r):l$(r)=t$
270 gosub325:z=0:gosub340:ifz=0then145
275 ifj<s(i)thens(i)=j
280 print"[147][159] this match is now over.":print"[156] player:"i,j"[156]moves."
285 print" press space"
290 geta$:ifa$<>" "then290
295 next:next:print"[147] [159]the game is now over.":print" here are the final ";
300 print"scores:":form=1top:print" [156]player"m"[157][156]:"s(m):next
305 print" would you like to play again (y/n)?"
310 geta$:ifa$="y"then65
315 ifa$<>"n"then310
320 print"[147][158]":end
325 print"[129]":form=1tog:printtab(14);:forn=1tog:print""l$((m-1)*g+n);
330 next:ifm<gthenprint""
335 next:return
340 forn=1tog*g-1:ifl$(n)>l$(n+1)thenreturn
345 next:z=1:return